package geekstudy.week1;

public class ListNode {

    int val;

    ListNode next;

    ListNode() {

    }

    ListNode(int val) {
        this.val = val;
    }

    ListNode(int val, ListNode next) {
        this.val = val;
        this.next = next;
    }

    String simpleString() {
        StringBuffer buffer = new StringBuffer();
        buffer.append("[").append(val);
        ListNode bufferNext = next;
        for(;bufferNext != null;) {
            buffer.append(", ").append(bufferNext.val);
            bufferNext = bufferNext.next;
        }

        buffer.append("]");

        return buffer.toString();
    }
}
